package yf.mall.vo.down;


import lombok.Data;

import java.util.Date;

import com.alibaba.excel.annotation.*;

import java.io.Serializable;


import java.math.BigDecimal;

import yf.mall.entity.AccountApplyEntity;
import yf.mall.enums.AccountTypeEnum;
import yf.mall.vo.AccountApplyVo;

import yf.mall.enums.AccountApplyStatusEnum;

/**
 * 账户申请实体
 * 表名 account_apply
 *
 *
 * 
 * @date Mon Oct 30 11:36:56 CST 2023
 */
@Data
public class AccountApplyDown implements Serializable {
    @ExcelIgnore
    private static final long serialVersionUID = 1L;

    //
    @ExcelProperty("")
    private Long id;

    //用户ID
    @ExcelProperty("用户ID")
    private Long userId;

    //手机号
    @ExcelProperty("手机号")
    private String mobile;

    //金额
    @ExcelProperty("金额")
    private BigDecimal amount;

    //类型
    @ExcelProperty("类型")
    private String type;

    //原因
    @ExcelProperty("原因")
    private String info;

    //备注
    @ExcelProperty("备注")
    private String remark;

    //申请时间
    @ExcelProperty("申请时间")
    private Date time;

    //申请人
    @ExcelProperty("申请人")
    private String admin;

    //ENUM-状态:"WAIT-待审核","SUCCESS-同意","REFUSE-拒绝"
    @ExcelIgnore
    private Integer status;
    @ExcelProperty("状态")
    private String statusStr;

    //更新时间
    @ExcelProperty("更新时间")
    private Date updateTime;


    public AccountApplyDown() {

    }

    public AccountApplyDown(AccountApplyVo vo) {
        AccountApplyEntity entity = vo.getEntity();
        this.setId(entity.getId());

        this.setUserId(entity.getUserId());

        this.setMobile(entity.getMobile());

        this.setAmount(entity.getAmount());

        this.setType(AccountTypeEnum.indexOf(entity.getType()));

        this.setInfo(entity.getInfo());

        this.setRemark(entity.getRemark());

        this.setTime(entity.getTime());

        this.setAdmin(entity.getAdmin());

        this.setStatus(entity.getStatus());
        if (entity.getStatus() != null) {
            this.setStatusStr(AccountApplyStatusEnum.indexOf(entity.getStatus()));
        }

        this.setUpdateTime(entity.getUpdateTime());

    }


}
